<template>
  <ul class="search-list">
    <li v-for="(item,index) in data" :key="index" @click="$emit('clickLi')">
      <div class="shop-introduce">
        <img :src="item.image_path" alt="" v-if="item.image_path">
        <i class="fa fa-search" v-else></i>
        <span>{{ item.name || item }}</span>
      </div>
      <div class="rating">
        <span v-if="item.rating">评分 {{ item.rating }}</span>
      </div>
    </li>
  </ul>
</template>

<script>
export default {
  name: 'SearchList',
  props: {
    data: Array
  }
}
</script>

<style lang="less" scoped>
.search-list {
  padding: 0 15px;
  background-color: #fff;
  li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #ccc;
    padding: 15px 0;
    .shop-introduce {
      display: flex;
      align-items: center;
      img {
        width: 45px;
        height: 45px;
      }
      span {
        width: 200px;
        margin-left: 8px;
        font-size: 14px;
        color: #333;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-weight: 600;
      }
    }
    .rating {
      color: #666;
      font-size: 14px;
    }
  }
}
</style>
